<?php
/**
 * 订单
 * User: yuanxuncheng
 * Date: 2017/1/2
 * Time: 21:45
 */

namespace app\api\controller;

use app\api\model\page\order\GetDuoBaoOrder;
use app\api\model\page\order\GetOrder as GetOrderModel;
use app\api\model\page\order\GetOrderDetail as GetOrderDetailModel;
use app\api\model\page\order\CreateOrder as CreateOrderModel;
use app\api\model\page\order\CancelOrder as CancelOrderModel;
use app\api\model\page\order\GetShippingInfoByOrder as GetShippingInfoByOrderModel;
use app\api\model\page\order\DeleteOrder as DeleteOrderModel;
use app\api\model\page\order\GetDuoBaoOrder as GetDuoBaoOrderModel;
use think\Request;

class Order
{

    private $createOrderModel;
    private $getOrderModel;
    private $getOrderDetailModel;
    private $cancelOrderModel;
    private $getShippingInfoByOrderModel;
    private $deleteOrderModel;
    private $getDuoBaoOrderModel;

    public function __construct()
    {
        $this->param = Request::instance()->param();
    }

    /**
     * @desc 创建订单
     * @return array
     * @throws \think\Exception
     */
    public function createOrder()
    {
        $this->createOrderModel = new CreateOrderModel();
        return $this->createOrderModel->excute($this->param);
    }

    /**
     * @desc 获取订单
     * @return array
     */
    public function getOrder()
    {
        $this->getOrderModel = new GetOrderModel();
        return $this->getOrderModel->excute($this->param);
    }

    /**
     * @desc 获取订单详情
     * @return array
     */
    public function getOrderDetail()
    {
        $this->getOrderDetailModel = new GetOrderDetailModel();
        return $this->getOrderDetailModel->excute($this->param);
    }

    /**
     * @desc 取消订单详情
     * @return array
     */
    public function cancelOrder()
    {
        $this->cancelOrderModel = new CancelOrderModel();
        return $this->cancelOrderModel->excute($this->param);
    }

    /**
     * @desc 删除订单
     * @return array
     */
    public function deleteOrder()
    {
        $this->deleteOrderModel = new DeleteOrderModel();
        return $this->deleteOrderModel->excute($this->param);
    }

    /**
     * @desc 根据订单获取物流配送详情
     * @return array
     */
    public function getShippingInfoByOrder()
    {
        $this->getShippingInfoByOrderModel = new GetShippingInfoByOrderModel();
        return $this->getShippingInfoByOrderModel->excute($this->param);
    }

    public function getDuoBaoOrder() {
        $this->getDuoBaoOrderModel = new GetDuoBaoOrder();
        return $this->getDuoBaoOrderModel->excute($this->param);
    }
}
